
#include "stdafx.h"
#include "agenda_scanner.h"

#include "iRingTray.h"
#include "agenda.h"

VOID CALLBACK ScheduleProc(HWND, UINT, UINT_PTR, DWORD)
{
	static WORD minute = 0;
	SYSTEMTIME st;
	GetSystemTime( &st );
	if (minute == st.wMinute)
	{
		return;
	}
	minute = st.wMinute;
	// Fire a minute event
	theApp.GetAgendaScanner()->OnNewMinuteEvent( st );
}

void AgendaScanner::Start()
{
	m_nScheduleTimer = 105;
	m_nScheduleTimer = SetTimer( NULL, m_nScheduleTimer, 5000, ScheduleProc );
}

AgendaScanner::AgendaScanner()
:m_nScheduleTimer(0)
{

}

AgendaScanner::~AgendaScanner()
{
	if (m_nScheduleTimer)
	{
		KillTimer(NULL, m_nScheduleTimer);
	}
}

BOOL AgendaScanner::OnNewMinuteEvent( SYSTEMTIME const& st )
{
	CTime time(st);

	DailyAgenda da; //? Get today agenda.<#DailyAgenda>
	
	if (da.RightTime( st ))
	{

	}

	return TRUE;
}
